{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Title: #Categorize Box According to Criteria"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Difficulty: #Easy"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Category Title: #Algorithms"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Tag Slug: #math"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Name Translated: #数学"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Solution Name: categorizeBox"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Translated Title: #根据规则将箱子分类"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Translated Content:\n",
    "<p>给你四个整数&nbsp;<code>length</code>&nbsp;，<code>width</code>&nbsp;，<code>height</code>&nbsp;和&nbsp;<code>mass</code>&nbsp;，分别表示一个箱子的三个维度和质量，请你返回一个表示箱子 <strong>类别</strong> 的字符串。</p>\n",
    "\n",
    "<ul>\n",
    "\t<li>如果满足以下条件，那么箱子是&nbsp;<code>\"Bulky\"</code>&nbsp;的：\n",
    "\n",
    "\t<ul>\n",
    "\t\t<li>箱子 <strong>至少有一个</strong> 维度大于等于 <code>10<sup>4</sup></code>&nbsp;。</li>\n",
    "\t\t<li>或者箱子的 <strong>体积</strong> 大于等于&nbsp;<code>10<sup>9</sup></code>&nbsp;。</li>\n",
    "\t</ul>\n",
    "\t</li>\n",
    "\t<li>如果箱子的质量大于等于&nbsp;<code>100</code>&nbsp;，那么箱子是&nbsp;<code>\"Heavy\"</code>&nbsp;的。</li>\n",
    "\t<li>如果箱子同时是&nbsp;<code>\"Bulky\"</code> 和&nbsp;<code>\"Heavy\"</code>&nbsp;，那么返回类别为&nbsp;<code>\"Both\"</code>&nbsp;。</li>\n",
    "\t<li>如果箱子既不是&nbsp;<code>\"Bulky\"</code>&nbsp;，也不是&nbsp;<code>\"Heavy\"</code>&nbsp;，那么返回类别为&nbsp;<code>\"Neither\"</code>&nbsp;。</li>\n",
    "\t<li>如果箱子是&nbsp;<code>\"Bulky\"</code>&nbsp;但不是&nbsp;<code>\"Heavy\"</code>&nbsp;，那么返回类别为&nbsp;<code>\"Bulky\"</code>&nbsp;。</li>\n",
    "\t<li>如果箱子是&nbsp;<code>\"Heavy\"</code>&nbsp;但不是&nbsp;<code>\"Bulky\"</code>&nbsp;，那么返回类别为&nbsp;<code>\"Heavy\"</code>&nbsp;。</li>\n",
    "</ul>\n",
    "\n",
    "<p><strong>注意</strong>，箱子的体积等于箱子的长度、宽度和高度的乘积。</p>\n",
    "\n",
    "<p>&nbsp;</p>\n",
    "\n",
    "<p><strong>示例 1：</strong></p>\n",
    "\n",
    "<pre>\n",
    "<b>输入：</b>length = 1000, width = 35, height = 700, mass = 300\n",
    "<b>输出：</b>\"Heavy\"\n",
    "<b>解释：</b>\n",
    "箱子没有任何维度大于等于 10<sup>4 </sup>。\n",
    "体积为 24500000 &lt;= 10<sup>9 </sup>。所以不能归类为 \"Bulky\" 。\n",
    "但是质量 &gt;= 100 ，所以箱子是 \"Heavy\" 的。\n",
    "由于箱子不是 \"Bulky\" 但是是 \"Heavy\" ，所以我们返回 \"Heavy\" 。</pre>\n",
    "\n",
    "<p><strong>示例 2：</strong></p>\n",
    "\n",
    "<pre>\n",
    "<b>输入：</b>length = 200, width = 50, height = 800, mass = 50\n",
    "<b>输出：</b>\"Neither\"\n",
    "<b>解释：</b>\n",
    "箱子没有任何维度大于等于 10<sup>4</sup>&nbsp;。\n",
    "体积为 8 * 10<sup>6</sup> &lt;= 10<sup>9</sup>&nbsp;。所以不能归类为 \"Bulky\" 。\n",
    "质量小于 100 ，所以不能归类为 \"Heavy\" 。\n",
    "由于不属于上述两者任何一类，所以我们返回 \"Neither\" 。</pre>\n",
    "\n",
    "<p>&nbsp;</p>\n",
    "\n",
    "<p><strong>提示：</strong></p>\n",
    "\n",
    "<ul>\n",
    "\t<li><code>1 &lt;= length, width, height &lt;= 10<sup>5</sup></code></li>\n",
    "\t<li><code>1 &lt;= mass &lt;= 10<sup>3</sup></code></li>\n",
    "</ul>\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Description: [categorize-box-according-to-criteria](https://leetcode.cn/problems/categorize-box-according-to-criteria/description/)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Solutions: [categorize-box-according-to-criteria](https://leetcode.cn/problems/categorize-box-according-to-criteria/solutions/)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "test_cases = ['1000\\n35\\n700\\n300', '200\\n50\\n800\\n50']"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def categorizeBox(self, length: int, width: int, height: int, mass: int) -> str:\n",
    "        bulky = any(atri >= 10**4 for atri in (length,width,height)) or length*width*height>=10**9\n",
    "        heavy = mass>=100\n",
    "        return {(True,True):\"Both\",(False,False):\"Neither\",(True,False):\"Bulky\",(False,True):\"Heavy\"}[(bulky,heavy)]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def categorizeBox(self, length, width, height, mass):\n",
    "        maxd = max(length, width, height)\n",
    "        vol = length * width * height\n",
    "        isBulky = maxd >= 10000 or vol >= 10**9\n",
    "        isHeavy = mass >= 100\n",
    "        if isBulky and isHeavy:\n",
    "            return 'Both'\n",
    "        if isBulky:\n",
    "            return 'Bulky'\n",
    "        if isHeavy:\n",
    "            return 'Heavy'\n",
    "        return 'Neither'\n",
    "\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def categorizeBox(self, length: int, width: int, height: int, mass: int) -> str:\n",
    "        b = max(length, width, height) >= 1e4 or length * width * height >= 1e9\n",
    "        h = mass >= 100\n",
    "\n",
    "        if b and h: return 'Both'\n",
    "        if b:   return 'Bulky'\n",
    "        if h:   return 'Heavy'\n",
    "        return 'Neither'"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "from functools import reduce\n",
    "\n",
    "class Solution:\n",
    "    def categorizeBox(self, length: int, width: int, height: int, mass: int) -> str:\n",
    "        dims = [length, width, height]\n",
    "        Bulky = max(dims) >= 10000 or reduce(lambda x, y : x * y, dims, 1) >= 1e9\n",
    "        Heavy = mass >= 100\n",
    "        if Bulky and Heavy:\n",
    "            return \"Both\"\n",
    "        elif not Bulky and not Heavy:\n",
    "            return \"Neither\"\n",
    "        return \"Bulky\"  if Bulky else \"Heavy\""
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def categorizeBox(self, length: int, width: int, height: int, mass: int) -> str:\n",
    "        ans = 0\n",
    "        v = length * width * height\n",
    "        if max(length, width, height) < 10 ** 4:\n",
    "            ans += 0\n",
    "            if v >= 10 ** 9:\n",
    "                ans += 2\n",
    "        else:\n",
    "            ans += 2\n",
    "        if mass >= 100:\n",
    "            ans += 1\n",
    "        if ans == 1:\n",
    "            return \"Heavy\"\n",
    "        elif ans == 2:\n",
    "            return \"Bulky\"\n",
    "        elif ans == 3:\n",
    "            return \"Both\"\n",
    "        else:\n",
    "            return \"Neither\""
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def categorizeBox(self, length: int, width: int, height: int, mass: int) -> str:\n",
    "        heavy = False\n",
    "        bulky = False\n",
    "        if length >= 10**4 or width >= 10**4 or height >= 10**4 or width * height * length >= 10**9:\n",
    "            bulky = True\n",
    "        if mass >= 100:\n",
    "            heavy = True\n",
    "        if bulky and heavy:\n",
    "            return \"Both\"\n",
    "        elif bulky and not heavy:\n",
    "            return \"Bulky\"\n",
    "        elif heavy and not bulky:\n",
    "            return \"Heavy\"\n",
    "        else:\n",
    "            return \"Neither\""
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def categorizeBox(self, length: int, width: int, height: int, mass: int) -> str:\n",
    "        b=False\n",
    "        h=False\n",
    "        if length>=10000 or width>=10000 or height>=10000 or length*width*height>=1000000000:\n",
    "            b=True\n",
    "        if mass>=100:\n",
    "            h=True\n",
    "        if b and h:\n",
    "            return \"Both\"\n",
    "        elif not b and not h:\n",
    "            return \"Neither\"\n",
    "        elif not b and h:\n",
    "            return \"Heavy\"\n",
    "        else:\n",
    "            return \"Bulky\""
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def categorizeBox(self, length: int, width: int, height: int, mass: int) -> str:\n",
    "        box_type = {1: \"Bulky\", 2: \"Heavy\", 3: \"Both\", 0: \"Neither\"}\n",
    "        score = 0\n",
    "        if max(length, width, height, mass) >= 10 ** 4 or length * width * height >= 10 ** 9:\n",
    "            score += 1\n",
    "        if mass >= 100:\n",
    "            score += 2\n",
    "        return box_type[score]\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def categorizeBox(self, length: int, width: int, height: int, mass: int) -> str:\n",
    "        lists=[]\n",
    "        if length >= 10**4 or length*width*height >= 10**9 or width >= 10**4 or height >= 10**4:\n",
    "            lists.append('Bulky')\n",
    "        if mass >= 100:\n",
    "            lists.append('Heavy')\n",
    "        if lists==[]:\n",
    "            return 'Neither'\n",
    "        if len(lists)>1:\n",
    "            return 'Both'\n",
    "        return lists[0]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def categorizeBox(self, length: int, width: int, height: int, mass: int) -> str:\n",
    "        signs = {'': \"Neither\", '0': \"Bulky\", '1': \"Heavy\", '01': \"Both\"}\n",
    "        sign =  \"\"\n",
    "        if max(length,width,height) >= 10**4 or length*width*height >= 10**9:\n",
    "            sign += '0'\n",
    "        if mass >= 100:\n",
    "            sign += '1'\n",
    "        return signs[sign]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "'''\n",
    "class Solution:\n",
    "    def categorizeBox(self, length: int, width: int, height: int, mass: int) -> str:\n",
    "        vol = length *width * height\n",
    "        if length > 1e+4 or width > 1e+4 or height > 1e+4 or vol > 1e+9:\n",
    "            v = 'Bulky'\n",
    "        else:\n",
    "            v = 0\n",
    "        if mass >= 100:\n",
    "            w = 'Heavy'\n",
    "        else:\n",
    "            w = 0\n",
    "        if v == 'Bulky':\n",
    "            if w == 'Heavy':\n",
    "                return 'Both'\n",
    "            else:\n",
    "                return 'Bulky'\n",
    "        else:\n",
    "            if w = 'Heavy':\n",
    "                return 'Heavy'\n",
    "            else:\n",
    "                return Neither\n",
    "'''\n",
    "\n",
    "class Solution:\n",
    "    def categorizeBox(self, length: int, width: int, height: int, mass: int) -> str:\n",
    "        vol = length *width * height\n",
    "        if length >= 1e+4 or width >= 1e+4 or height >= 1e+4 or vol >= 1e+9:\n",
    "            if mass >= 100:\n",
    "                return 'Both'\n",
    "            else:\n",
    "                return 'Bulky'\n",
    "        else:\n",
    "            if mass >= 100:\n",
    "                return 'Heavy'\n",
    "            else:\n",
    "                return 'Neither'"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def categorizeBox(self, length: int, width: int, height: int, mass: int) -> str:\n",
    "        B=max(length,width,height)>=10**4 or length*width*height>=10**9\n",
    "        H=mass>=100\n",
    "        if B and H:\n",
    "            return 'Both'\n",
    "        if B:\n",
    "            return 'Bulky'\n",
    "        if H:\n",
    "            return 'Heavy'\n",
    "        return 'Neither'\n",
    "\n",
    "\n",
    "\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def categorizeBox(self, length: int, width: int, height: int, mass: int) -> str:\n",
    "        l = ['Neither','Bulky','Heavy','Both']\n",
    "        i = 0\n",
    "        if length >= 10000 or width >= 10000 or height >= 10000 or length * width * height >= 10**9:    \n",
    "            i += 1\n",
    "        if mass >= 100:\n",
    "            i += 2\n",
    "        return l[i]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def categorizeBox(self, length: int, width: int, height: int, mass: int) -> str:\n",
    "        maxd = max(length, width, height)\n",
    "        vol = length * width * height\n",
    "        isBulky = maxd >= 10000 or vol >= 10**9\n",
    "        isHeavy = mass >= 100\n",
    "        if isBulky and isHeavy:\n",
    "            return 'Both'\n",
    "        if isBulky:\n",
    "            return 'Bulky'\n",
    "        if isHeavy:\n",
    "            return 'Heavy'\n",
    "        return 'Neither'"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def categorizeBox(self, length: int, width: int, height: int, mass: int) -> str:\n",
    "        v = length * width * height\n",
    "        if v >= 10**9 or length >= 10**4 or width >= 10**4 or height >= 10**4 :\n",
    "            if mass >= 100:\n",
    "                return \"Both\"\n",
    "            else:\n",
    "                return \"Bulky\"\n",
    "        elif mass >= 100:\n",
    "            return 'Heavy'\n",
    "        return 'Neither'"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def categorizeBox(self, length: int, width: int, height: int, mass: int) -> str:\n",
    "        v = length * width * height\n",
    "        bulky = int(any(x >= 10000 for x in (length, width, height)) or v >= 10**9)\n",
    "        heavy = int(mass >= 100)\n",
    "        i = heavy << 1 | bulky\n",
    "        d = ['Neither', 'Bulky', 'Heavy', 'Both']\n",
    "        return d[i]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def categorizeBox(self, length: int, width: int, height: int, mass: int) -> str:\n",
    "        volume = length * width * height\n",
    "        is_bulky = max(length, width, height) >= 10000 or volume >= 10**9\n",
    "        is_heavy = mass >= 100\n",
    "        if is_bulky and is_heavy:\n",
    "            return 'Both'\n",
    "        elif is_bulky:\n",
    "            return 'Bulky'\n",
    "        elif is_heavy:\n",
    "            return 'Heavy'\n",
    "        else:\n",
    "            return 'Neither'"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def categorizeBox(self, length: int, width: int, height: int, mass: int) -> str:\n",
    "        three=[length,width,height]\n",
    "        three.sort()\n",
    "        if three[-1]>=10**4 or length*width*height>=10**9:\n",
    "            if mass>=100: return \"Both\"\n",
    "            else:return \"Bulky\"\n",
    "        else:\n",
    "            if mass>=100: return \"Heavy\"\n",
    "            else:return \"Neither\""
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def categorizeBox(self, length: int, width: int, height: int, mass: int) -> str:\n",
    "        buiky = '1' if length>=10**4 or width>=10**4 or height>=10**4 or length*width*height >=10 **9 else '0'\n",
    "        heavy = '1' if mass >=100 else '0'\n",
    "        dict_result ={'11':\"Both\",\"00\":\"Neither\",\"10\":\"Bulky\",\"01\":\"Heavy\"}\n",
    "        return dict_result[buiky+heavy]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "t = 10 ** 4\n",
    "p = 10 ** 9\n",
    "class Solution:\n",
    "    def categorizeBox(self, length: int, width: int, height: int, mass: int) -> str:\n",
    "        isBulky = (length >= t) or (width >= t) or (height >= t) or ((length * height * width) >= p)\n",
    "        isHeavy = mass >= 100\n",
    "        if isBulky and isHeavy: return 'Both'\n",
    "        if isBulky: return 'Bulky'\n",
    "        if isHeavy: return 'Heavy'\n",
    "        return 'Neither'"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def categorizeBox(self, length: int, width: int, height: int, mass: int) -> str:\n",
    "        v1, v2 = 10 ** 9, 10 ** 4\n",
    "        vol = length * width * height\n",
    "        flag1, flag2 = False, False\n",
    "        if vol >= v1 or (length >= v2 or width >= v2 or height >= v2):\n",
    "            flag1 = True\n",
    "        if mass >= 100:\n",
    "            flag2 = True\n",
    "        if flag1 and flag2:\n",
    "            return \"Both\"\n",
    "        elif flag1 and not flag2:\n",
    "            return \"Bulky\"\n",
    "        elif not flag1 and flag2:\n",
    "            return \"Heavy\"\n",
    "        else:\n",
    "            return \"Neither\""
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def categorizeBox(self, length: int, width: int, height: int, mass: int) -> str:\n",
    "        result = []\n",
    "        if length >= 10**4 or width >= 10**4 or height >= 10**4 or length*width*height>=10**9:\n",
    "            result.append('Bulky')\n",
    "        if mass >= 100: result.append('Heavy')\n",
    "        \n",
    "        if len(result) == 2: return 'Both'\n",
    "        elif len(result) == 0: return 'Neither'\n",
    "        else: return result[0]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def categorizeBox(self, length: int, width: int, height: int, mass: int) -> str:\n",
    "        maxd = max(length, width, height)\n",
    "        vol = length * width * height\n",
    "        isBulky = maxd >= 10000 or vol >= 10**9\n",
    "        isHeavy = mass >= 100\n",
    "        if isBulky and isHeavy:\n",
    "            return 'Both'\n",
    "        if isBulky:\n",
    "            return 'Bulky'\n",
    "        if isHeavy:\n",
    "            return 'Heavy'\n",
    "        return 'Neither'"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def categorizeBox(self, length: int, width: int, height: int, mass: int) -> str:\n",
    "        bulky = 0\n",
    "        heavy = 0\n",
    "        if max(length,width,height)>=10000 or length*width*height>=1000000000:\n",
    "            bulky = 1\n",
    "        if mass>=100:heavy = 1\n",
    "        if bulky and heavy:return \"Both\"\n",
    "        elif bulky:return \"Bulky\"\n",
    "        elif heavy:return \"Heavy\"\n",
    "        else:return \"Neither\""
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def categorizeBox(self, length: int, width: int, height: int, mass: int) -> str:\n",
    "        bflag = False\n",
    "        if any(x >= 10000 for x in [length, width, height]) or length * width * height >= 10 ** 9:\n",
    "            bflag = True\n",
    "        hflag = mass >= 100\n",
    "\n",
    "        if bflag and hflag:\n",
    "            return 'Both'\n",
    "        if bflag:\n",
    "            return 'Bulky'\n",
    "        if hflag:\n",
    "            return 'Heavy'\n",
    "        return 'Neither'\n",
    "\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def categorizeBox(self, length: int, width: int, height: int, mass: int) -> str:\n",
    "        ans = \"Neither\"\n",
    "\n",
    "        if length >= 10000 or width >= 10000 or height >= 10000 or length * width * height >= 1000000000:\n",
    "            ans = \"Bulky\"\n",
    "        \n",
    "        if mass >= 100:\n",
    "            if ans == \"Bulky\":\n",
    "                ans = \"Both\"\n",
    "            else:\n",
    "                ans = \"Heavy\"\n",
    "        \n",
    "        return ans"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def categorizeBox(self, length: int, width: int, height: int, mass: int) -> str:\n",
    "        ##heavy bulky\n",
    "        rlt=[0,0]\n",
    "        if mass>=100:\n",
    "            rlt[0]=10\n",
    "        if (length >=10000)|(width  >=10000)|(height  >=10000)|(length*width*height>=1000000000):\n",
    "            rlt[1]=10\n",
    "        if rlt[0]==0:\n",
    "            if rlt[1]==0:\n",
    "                return 'Neither'\n",
    "            else:\n",
    "                return 'Bulky'\n",
    "        else:\n",
    "            if rlt[1]==0:\n",
    "                return 'Heavy'\n",
    "            else:\n",
    "                return 'Both'\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def categorizeBox(self, length: int, width: int, height: int, mass: int) -> str:\n",
    "        m = 0\n",
    "        n = 0\n",
    "        dict = {0:\"Neither\",1:\"Heavy\",2:\"Bulky\",3:\"Both\"}\n",
    "        if (length >= 10**4)|(width >= 10**4)|(height >= 10**4)|(length*width*height >=10**9)== 1:\n",
    "            m = 1\n",
    "        if (mass >= 100):\n",
    "            n = 1\n",
    "        return dict[m*2+n]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def categorizeBox(self, length: int, width: int, height: int, mass: int) -> str:\n",
    "        ans = \"Neither\"\n",
    "        if length >= 10e3 or width >= 10e3 or height >= 10e3 or length * width * height >= 10e8:\n",
    "            ans = \"Bulky\"\n",
    "            if mass >= 100:\n",
    "                ans = \"Both\"\n",
    "\n",
    "        if mass >= 100:\n",
    "            ans = \"Heavy\"\n",
    "            if length >= 10e3 or width >= 10e3 or height >= 10e3 or length * width * height >= 10e8:\n",
    "                ans = \"Both\"\n",
    "\n",
    "        return ans"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def categorizeBox(self, length: int, width: int, height: int, mass: int) -> str:\n",
    "        box1 = \"\"\n",
    "        box2 = \"\"\n",
    "        if length >= 10**4 or width >= 10**4 or height >= 10**4 or length*width*height >= 10**9:\n",
    "            box1 = \"Bulky\"\n",
    "            res = \"Bulky\"\n",
    "        if mass >= 100:\n",
    "            box2 = \"Heavy\"\n",
    "        if box1 != \"\" and box2 != \"\":\n",
    "            return \"Both\"\n",
    "        if box1 != \"\" and box2 == \"\":\n",
    "            return box1\n",
    "        if box2 != \"\" and box1 == \"\":\n",
    "            return box2\n",
    "        return \"Neither\""
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def categorizeBox(self, length: int, width: int, height: int, mass: int) -> str:\n",
    "        j1 = 0\n",
    "        if length >= 10**4 or width >= 10**4 or height >= 10**4 or mass >= 10**4 or length * width * height >= 10**9:\n",
    "            j1 = 1\n",
    "        if mass >= 100 and j1 == 1:\n",
    "            return  \"Both\"\n",
    "        elif mass < 100 and j1 == 0:\n",
    "            return \"Neither\"\n",
    "        elif mass >= 100 and j1 == 0:\n",
    "            return \"Heavy\"\n",
    "        elif mass < 100 and j1 == 1:\n",
    "            return \"Bulky\""
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def categorizeBox(self, length: int, width: int, height: int, mass: int) -> str:\n",
    "        res = ['Neither', 'Heavy', 'Bulky', 'Both']\n",
    "        idx = 0\n",
    "        if (length | width | height) >= 10**4 or length*width*height >= 10**9:\n",
    "            idx += 2\n",
    "        idx += (mass >= 100)\n",
    "        return res[idx]\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def categorizeBox(self, length: int, width: int, height: int, mass: int) -> str:\n",
    "        isBulky = any([x >= 10**4 for x in [length, width, height]]) or length * width * height >= 10**9\n",
    "        isHeavy = mass >= 100\n",
    "        if isBulky and isHeavy:\n",
    "            return \"Both\"\n",
    "        elif isBulky:\n",
    "            return \"Bulky\"\n",
    "        elif isHeavy:\n",
    "            return \"Heavy\"\n",
    "        else:\n",
    "            return \"Neither\""
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def categorizeBox(self, length: int, width: int, height: int, mass: int) -> str:\n",
    "        bulky = (length >= 10**4 or height >= 10 **4 or width >= 10**4) or length * width * height >= 10**9\n",
    "        heavy = mass >= 100 \n",
    "\n",
    "        if bulky and  heavy :\n",
    "            return 'Both'\n",
    "        if not bulky and not heavy :\n",
    "            return 'Neither' \n",
    "\n",
    "        if bulky :\n",
    "            return 'Bulky'\n",
    "        \n",
    "        if heavy :\n",
    "            return 'Heavy'\n",
    "        \n",
    "        return None "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "\n",
    "    def categorizeBox(self, length: int, width: int, height: int, mass: int) -> str:\n",
    "\n",
    "        v = length * width * height\n",
    "\n",
    "        bulky = int(any(x >= 10000 for x in (length, width, height)) or v >= 10**9)\n",
    "\n",
    "        heavy = int(mass >= 100)\n",
    "\n",
    "        i = heavy << 1 | bulky\n",
    "\n",
    "        d = ['Neither', 'Bulky', 'Heavy', 'Both']\n",
    "\n",
    "        return d[i]\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def categorizeBox(self, length: int, width: int, height: int, mass: int) -> str:\n",
    "        volume=length*width*height\n",
    "        result=[]\n",
    "        if length>=10**4 or width>=10**4 or height>=10**4 or volume>=10**9:\n",
    "            result.append('bulky')\n",
    "        if mass>=100:\n",
    "            result.append('heavy')\n",
    "        if 'bulky' in result and 'heavy' in result:\n",
    "            return 'Both'\n",
    "        elif 'bulky' in result and 'heavy' not in result:\n",
    "            return 'Bulky'\n",
    "        elif 'bulky' not in result and 'heavy' in result:\n",
    "            return 'Heavy'\n",
    "        elif 'bulky' not in result and 'heavy' not in result:\n",
    "            return 'Neither'"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def categorizeBox(self, length: int, width: int, height: int, mass: int) -> str:\n",
    "        bulky = length>=10000 or width>=10000 or height>=10000 or mass >= 10000 or length*width*height >= 10**9\n",
    "        heavy = mass>=100\n",
    "        if bulky and heavy:\n",
    "            return \"Both\"\n",
    "        elif bulky and not heavy:\n",
    "            return \"Bulky\"\n",
    "        elif not bulky and heavy:\n",
    "            return \"Heavy\"\n",
    "        else:\n",
    "            return \"Neither\""
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def categorizeBox(self, length: int, width: int, height: int, mass: int) -> str:\n",
    "        maxd = max(length, width, height)\n",
    "        vol = length * width * height\n",
    "        isBulky = maxd >= 10000 or vol >= 10**9\n",
    "        isHeavy = mass >= 100\n",
    "        if isBulky and isHeavy:\n",
    "            return 'Both'\n",
    "        if isBulky:\n",
    "            return 'Bulky'\n",
    "        if isHeavy:\n",
    "            return 'Heavy'\n",
    "        return 'Neither'"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def categorizeBox(self, length, width, height, mass):\n",
    "        maxd = max(length, width, height)\n",
    "        vol = length * width * height\n",
    "        isBulky = maxd >= 10000 or vol >= 10**9\n",
    "        isHeavy = mass >= 100\n",
    "        if isBulky and isHeavy:\n",
    "            return 'Both'\n",
    "        if isBulky:\n",
    "            return 'Bulky'\n",
    "        if isHeavy:\n",
    "            return 'Heavy'\n",
    "        return 'Neither'"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def categorizeBox(self, length: int, width: int, height: int, mass: int) -> str:\n",
    "        if length >= 10000 or width >= 10000 or height >= 10000 or length * width * height >= 10**9:\n",
    "            a = 1\n",
    "        else: a = 0\n",
    "        if mass >= 100:\n",
    "            b = 1\n",
    "        else: b = 0\n",
    "        if a == 1 and b == 1:\n",
    "            return 'Both'\n",
    "        elif a == 1 and b == 0:\n",
    "            return 'Bulky'\n",
    "        elif a == 0 and b == 1:\n",
    "            return 'Heavy'\n",
    "        else: return 'Neither'\n",
    "            "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def categorizeBox(self, length: int, width: int, height: int, mass: int) -> str:\n",
    "        singleLimit = 10000      # 单个维度的限制\n",
    "        volumeLimit = 1000000000 # 体积的限制\n",
    "        flag = 0\n",
    "        if length >= singleLimit or width >= singleLimit or height >= singleLimit or length * width *height >= volumeLimit: flag += 1  # 满足Bulky条件，标志位+1\n",
    "        if mass >= 100: flag += 2   # 满足Heavy条件，标志位+2\n",
    "        if flag == 0: return \"Neither\"\n",
    "        if flag == 1: return \"Bulky\"\n",
    "        if flag == 2: return \"Heavy\"\n",
    "        return \"Both\"\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def categorizeBox(self, length: int, width: int, height: int, mass: int) -> str:\n",
    "        singleLimit = 10000      # 单个维度的限制\n",
    "        volumeLimit = 1000000000 # 体积的限制\n",
    "        flag = 0\n",
    "        if length >= singleLimit or width >= singleLimit or height >= singleLimit or length * width *height >= volumeLimit: flag += 1  # 满足Bulky条件，标志位+1\n",
    "        if mass >= 100: flag += 2   # 满足Heavy条件，标志位+2\n",
    "        if flag == 0: return \"Neither\"\n",
    "        if flag == 1: return \"Bulky\"\n",
    "        if flag == 2: return \"Heavy\"\n",
    "        return \"Both\"\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def categorizeBox(self, length: int, width: int, height: int, mass: int) -> str:\n",
    "        v = length * width * height\n",
    "        bulky = int(any(x >= 10000 for x in (length, width, height)) or v >= 10**9)\n",
    "        heavy = int(mass >= 100)\n",
    "        i = heavy << 1 | bulky\n",
    "        d = ['Neither', 'Bulky', 'Heavy', 'Both']\n",
    "        return d[i]\n",
    "\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def categorizeBox(self, length: int, width: int, height: int, mass: int) -> str:\n",
    "        def Bulky(x, y, z):\n",
    "            return True if max(x, y, z) >= 10**4 or x*y*z >= 10**9 else False\n",
    "        def Heavy(m):\n",
    "            return True if  m >= 100 else False\n",
    "        \n",
    "        if Bulky(length, width, height):\n",
    "            return 'Both' if Heavy(mass) else 'Bulky'\n",
    "        return 'Heavy' if Heavy(mass) else 'Neither'\n",
    "\n",
    "\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def categorizeBox(self, a: int, b: int, c: int, d: int) -> str:\n",
    "        return [[\"Neither\",\"Heavy\"],[\"Bulky\",\"Both\"]][max(a,b,c,d)>=10**4 or a*b*c>=10**9][d>=100]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def categorizeBox(self, length: int, width: int, height: int, mass: int) -> str:\n",
    "        B = length>=1e4 or width>=1e4 or height>=1e4 or length*width*height>=1e9\n",
    "        H = mass>=100\n",
    "        return \"Both\" if B and H else \"Bulky\" if B else \"Heavy\" if H else \"Neither\""
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def categorizeBox(self, length: int, width: int, height: int, mass: int) -> str:\n",
    "        bulky, heavy = False, False\n",
    "        if length >= 10000 or width >= 10000 or height >= 10000 or length*width*height >= 1000000000:\n",
    "            bulky = True\n",
    "        if mass >= 100:\n",
    "            heavy = True\n",
    "        if bulky and heavy:\n",
    "            return 'Both'\n",
    "        elif not bulky and not heavy:\n",
    "            return 'Neither'\n",
    "        elif bulky:\n",
    "            return 'Bulky'\n",
    "        elif heavy:\n",
    "            return 'Heavy'"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def categorizeBox(self, length: int, width: int, height: int, mass: int) -> str:\n",
    "        __=max(length,width,height,mass)>=pow(10,4) or length*width*height>=pow(10,9)\n",
    "        ___=mass>=100\n",
    "        if __ and ___ :\n",
    "            return \"Both\"\n",
    "        if __:\n",
    "            return \"Bulky\"\n",
    "        if ___ :\n",
    "            return \"Heavy\"\n",
    "        else:\n",
    "            return \"Neither\""
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def categorizeBox(self, length: int, width: int, height: int, mass: int) -> str:\n",
    "        if length >= 10000 or width >= 10000 or height >= 10000 or length * width * height >= 1000000000 :\n",
    "            Bulky = True\n",
    "        else :\n",
    "            Bulky = False\n",
    "        if mass >= 100 :\n",
    "            Heavy = True\n",
    "        else :\n",
    "            Heavy = False\n",
    "        \n",
    "        if Bulky and Heavy :\n",
    "            return \"Both\"\n",
    "        if not Bulky and not Heavy :\n",
    "            return \"Neither\"\n",
    "        if Bulky :\n",
    "            return \"Bulky\"\n",
    "        if Heavy :\n",
    "            return \"Heavy\""
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def categorizeBox(self, length: int, width: int, height: int, mass: int) -> str:\n",
    "         return [\"Neither\", \"Bulky\", \"Heavy\", \"Both\"][any([length >= 10000, width >= 10000, height >= 10000, length * width * height >= 1000000000]) | ((mass >= 100) << 1)]\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def categorizeBox(self, length: int, width: int, height: int, mass: int) -> str:\n",
    "        # lst=[\" Bulky\",\"Heavy\",\"Neither\"]\n",
    "        V=length*width*height \n",
    "        m=max(length,width,height)\n",
    "        if m>=10**4 or V>=10**9:\n",
    "            if mass>=10**2:\n",
    "                return \"Both\"\n",
    "            elif mass<10**2:\n",
    "                return \"Bulky\"    \n",
    "        elif mass>=10**2:\n",
    "            return \"Heavy\"\n",
    "        else:\n",
    "            return \"Neither\"\n",
    "\n",
    "\n",
    "\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def categorizeBox(self, length: int, width: int, height: int, mass: int) -> str:\n",
    "        Heavy = 1 if mass >= 100 else 0\n",
    "        Bulky = 1 if max(length, width, height) >= 10**4 or\\\n",
    "                    length*width*height>=10**9 else 0\n",
    "        if Heavy and Bulky:\n",
    "            return \"Both\"\n",
    "        elif Bulky and not Heavy:\n",
    "            return \"Bulky\"\n",
    "        elif Heavy and not Bulky:\n",
    "            return \"Heavy\"\n",
    "        else:\n",
    "            return \"Neither\"\n",
    "\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def categorizeBox(self, length: int, width: int, height: int, mass: int) -> str:\n",
    "        Bulky = False\n",
    "        Heavy = False\n",
    "        if length>=10000 or width>=10000 or height>=10000 or length*width*height>=1000000000:\n",
    "            Bulky = True\n",
    "        if mass>=100:\n",
    "            Heavy = True\n",
    "        if Bulky and Heavy:\n",
    "            return 'Both'\n",
    "        elif Bulky:\n",
    "            return 'Bulky'\n",
    "        elif Heavy:\n",
    "            return 'Heavy'\n",
    "        else:\n",
    "            return 'Neither'"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def categorizeBox(self, length: int, width: int, height: int, mass: int) -> str:\n",
    "        flag1 = 1 if length >= 10000 or width >= 10000 or height >= 10000 or length*width*height >= 10**9 else 0\n",
    "        flag2 = 1 if mass >= 100 else 0\n",
    "        match (flag1,flag2):\n",
    "            case (1,1):\n",
    "                return \"Both\"\n",
    "            case (1,0):\n",
    "                return \"Bulky\"\n",
    "            case (0,1):\n",
    "                return \"Heavy\"\n",
    "            case (0,0):\n",
    "                return \"Neither\"\n",
    "            "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def categorizeBox(self, length: int, width: int, height: int, mass: int) -> str:       \n",
    "        a=0\n",
    "        if length>=10**4 or width>=10**4 or height>=10**4 or mass>=10**4 or length*width*height>=10**9:\n",
    "            a+=1\n",
    "            b=\"Bulky\"\n",
    "        if  mass>=100:\n",
    "            a+=1\n",
    "            b=\"Heavy\"\n",
    "        if a==2:\n",
    "            return \"Both\"\n",
    "        if a==0:\n",
    "            return \"Neither\"        \n",
    "        return b\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def categorizeBox(self, length: int, width: int, height: int, mass: int) -> str:\n",
    "        boo1, boo2 = 0, 0\n",
    "        if length >= 10000 or width >= 10000 or height >= 10000 or length * width * height >= 1000000000:\n",
    "            boo1 = 1\n",
    "        if mass >= 100:\n",
    "            boo2 = 1\n",
    "        if boo1 + boo2 == 2:\n",
    "            return \"Both\"\n",
    "        elif boo1 == 1:\n",
    "            return \"Bulky\"\n",
    "        elif boo2 == 1:\n",
    "            return \"Heavy\"\n",
    "        else:\n",
    "            return \"Neither\""
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def categorizeBox(self, length: int, width: int, height: int, mass: int) -> str:\n",
    "        isBulky = max(length, width, height) >= 10000 or length * width * height >= 10**9\n",
    "        isHeavy = mass >= 100\n",
    "        if isBulky and isHeavy:\n",
    "            return 'Both'\n",
    "        if isBulky:\n",
    "            return 'Bulky'\n",
    "        if isHeavy:\n",
    "            return 'Heavy'\n",
    "        return 'Neither'\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def categorizeBox(self, length: int, width: int, height: int, mass: int) -> str:\n",
    "        volume = length * width * height\n",
    "        maxd = max(length, width, height)\n",
    "        isBulky = False\n",
    "        if volume >= 10 ** 9 or maxd >= 10 **4:\n",
    "            isBulky = True\n",
    "        if isBulky and mass >= 100:\n",
    "            return \"Both\"\n",
    "        elif isBulky:\n",
    "            return \"Bulky\"\n",
    "        elif mass >= 100:\n",
    "            return \"Heavy\"\n",
    "        else:\n",
    "            return \"Neither\""
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def categorizeBox(self, length: int, width: int, height: int, mass: int) -> str:\n",
    "        vol = length * width * height\n",
    "        box = [0, 0]\n",
    "        if vol >= 10 ** 9 or max(length, width, height) >= 10 ** 4:\n",
    "            box[0] = 1\n",
    "        if mass >= 100:\n",
    "            box[1] = 1\n",
    "        if box == [1, 1]:\n",
    "            return \"Both\"\n",
    "        if box == [1, 0]:\n",
    "            return \"Bulky\"\n",
    "        if box == [0, 1]:\n",
    "            return \"Heavy\"\n",
    "        if box == [0, 0]:\n",
    "            return \"Neither\""
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def categorizeBox(self, a: int, b: int, c: int, d: int) -> str:\n",
    "        return [[\"Neither\",\"Heavy\"],[\"Bulky\",\"Both\"]][max(a,b,c,d)>=10**4 or a*b*c>=10**9][d>=100]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def categorizeBox(self, length: int, width: int, height: int, mass: int) -> str:\n",
    "        flag1 = 1 if length >= 10000 or width >= 10000 or height >= 10000 or length*width*height >= 10**9 else 0\n",
    "        flag2 = 1 if mass >= 100 else 0\n",
    "        match (flag1,flag2):\n",
    "            case (1,1):\n",
    "                return \"Both\"\n",
    "            case (1,0):\n",
    "                return \"Bulky\"\n",
    "            case (0,1):\n",
    "                return \"Heavy\"\n",
    "            case (0,0):\n",
    "                return \"Neither\"\n",
    "        #return [[\"Neither\",\"Heavy\"],[\"Bulky\",\"Both\"]][max(a,b,c,d)>=10**4 or a*b*c>=10**9][d>=100]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def categorizeBox(self, length: int, width: int, height: int, mass: int) -> str:\n",
    "        flag1 = (length >= 1e4 or width >= 1e4 or height >= 1e4) or length * width * height >= 1e9\n",
    "        flag2 = mass >= 100\n",
    "\n",
    "        if flag1 and flag2:\n",
    "            return \"Both\"\n",
    "        elif flag1:\n",
    "            return \"Bulky\"\n",
    "        elif flag2:\n",
    "            return \"Heavy\"\n",
    "        else:\n",
    "            return \"Neither\""
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def categorizeBox(self, length: int, width: int, height: int, mass: int) -> str:\n",
    "        a, b = 0, 0\n",
    "        if any(n >= 10 ** 4 for n in [length, width, height]) or length * width * height >= 10 ** 9:\n",
    "            a = 1\n",
    "        if mass >= 100:\n",
    "            b = 1\n",
    "\n",
    "        if a and b:\n",
    "            return \"Both\"\n",
    "        elif not a and not b:\n",
    "            return \"Neither\"\n",
    "        elif a and not b:\n",
    "            return \"Bulky\"\n",
    "        elif not a and b:\n",
    "            return \"Heavy\""
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def categorizeBox(self, length: int, width: int, height: int, mass: int) -> str:\n",
    "        B = 0\n",
    "        H = 0\n",
    "        if length>= 10000 or width >= 10000 or height>=10000 or length*width*height >= 1e9:\n",
    "            B = 1\n",
    "        if mass >= 100:\n",
    "            H = 1\n",
    "        if B == 1 and H == 1:\n",
    "            return 'Both'\n",
    "        elif B == 1 and H == 0:\n",
    "            return 'Bulky'\n",
    "        elif B == 0 and H == 1:\n",
    "            return 'Heavy'\n",
    "        else:\n",
    "            return 'Neither'\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def categorizeBox(self, length, width, height, mass):\n",
    "        maxd = max(length, width, height)\n",
    "        vol = length * width * height\n",
    "        isBulky = maxd >= 10000 or vol >= 10**9\n",
    "        isHeavy = mass >= 100\n",
    "        if isBulky and isHeavy:\n",
    "            return 'Both'\n",
    "        if isBulky:\n",
    "            return 'Bulky'\n",
    "        if isHeavy:\n",
    "            return 'Heavy'\n",
    "        return 'Neither'\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def categorizeBox(self, length: int, width: int, height: int, mass: int) -> str:\n",
    "        volume = length * width * height\n",
    "        boxtype = []\n",
    "        if length >= 10000 or width >= 10000 or height >= 10000 or volume >= 1000000000:\n",
    "            boxtype.append('Bulky')\n",
    "        if mass >= 100:\n",
    "            boxtype.append('Heavy')\n",
    "        if 'Bulky' in boxtype and 'Heavy' in boxtype:\n",
    "            return 'Both'\n",
    "        elif 'Bulky' in boxtype and 'Heavy' not in boxtype:\n",
    "            return 'Bulky'\n",
    "        elif 'Bulky' not in boxtype and 'Heavy' in boxtype:\n",
    "            return 'Heavy'\n",
    "        else:\n",
    "            return 'Neither'"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def categorizeBox(self, length: int, width: int, height: int, mass: int) -> str:\n",
    "        vol = length * width * height\n",
    "        box = [0, 0]\n",
    "        if vol >= 10 ** 9 or length >= 10 ** 4 or width >= 10 ** 4 or height >= 10 ** 4:\n",
    "            box[0] = 1\n",
    "        if mass >= 100:\n",
    "            box[1] = 1\n",
    "        if box == [1, 1]:\n",
    "            return \"Both\"\n",
    "        if box == [1, 0]:\n",
    "            return \"Bulky\"\n",
    "        if box == [0, 1]:\n",
    "            return \"Heavy\"\n",
    "        if box == [0, 0]:\n",
    "            return \"Neither\""
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def categorizeBox(self, length: int, width: int, height: int, mass: int) -> str:\n",
    "        a, b = 0, 0\n",
    "        if (length >= 10000 or width >= 10000 or height >= 10000) or length * width * height >= 1000000000:\n",
    "            a = 1\n",
    "        if mass >= 100:\n",
    "            b = 1\n",
    "\n",
    "        if a and b:\n",
    "            return \"Both\"\n",
    "        elif not a and not b:\n",
    "            return \"Neither\"\n",
    "        elif a and not b:\n",
    "            return \"Bulky\"\n",
    "        elif not a and b:\n",
    "            return \"Heavy\""
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def categorizeBox(self, length: int, width: int, height: int, mass: int) -> str:\n",
    "        box_array = []\n",
    "        if length >= 10**4 or width >= 10**4 or height >= 10**4 or mass >= 10**4 or length*width*height >= 10**9:\n",
    "            box_name = \"Bulky\"\n",
    "            box_array.append(box_name)\n",
    "        if mass >= 100:\n",
    "            box_name = \"Heavy\"\n",
    "            box_array.append(box_name)\n",
    "        if len(box_array) == 0:\n",
    "            return \"Neither\"\n",
    "        return self.judgmentCategory(box_array)\n",
    "\n",
    "    def judgmentCategory(self, box_array):\n",
    "        if box_array == [\"Bulky\", \"Heavy\"]:\n",
    "            return \"Both\"\n",
    "        elif box_array == [\"Bulky\"]:\n",
    "            return \"Bulky\"\n",
    "        elif box_array == [\"Heavy\"]:\n",
    "            return \"Heavy\"\n",
    "        else:\n",
    "            return \"Neither\""
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def categorizeBox(self, length: int, width: int, height: int, mass: int) -> str:\n",
    "        b=0\n",
    "        h=0\n",
    "        if width>=10000 or length>=10000 or height>=10000 or width*length*height>=1000000000:\n",
    "            b=1\n",
    "        if mass>=100:\n",
    "            h=1\n",
    "        if b==1:\n",
    "            if h==1:\n",
    "                return 'Both'\n",
    "            return 'Bulky'\n",
    "        if h==1:\n",
    "            return 'Heavy'\n",
    "        return 'Neither'"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def categorizeBox(self, length: int, width: int, height: int, mass: int) -> str:\n",
    "        # type = None\n",
    "        v = length * width * height\n",
    "        Heavy, Bulky, Neither, Both = False, False, False, False\n",
    "        if length >= 10000 or width >= 10000 or height >= 10000 or v>=1000000000:\n",
    "            Bulky = True\n",
    "\n",
    "        if mass >= 100:\n",
    "            Heavy = True\n",
    "\n",
    "        if Bulky and Heavy:\n",
    "            type = \"Both\"\n",
    "        elif not Bulky and not Heavy:\n",
    "            type = \"Neither\"\n",
    "        elif Bulky and not Heavy:\n",
    "            type =\"Bulky\"\n",
    "        elif Heavy and not Bulky:\n",
    "            type=\"Heavy\"\n",
    "        print(type)\n",
    "        return type"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def categorizeBox(self, length: int, width: int, height: int, mass: int) -> str:\n",
    "        maxd = max(length, width, height)\n",
    "        vol = length * width * height\n",
    "        isBulky = maxd >= 10000 or vol >= 10**9\n",
    "        isHeavy = mass >= 100\n",
    "        if isBulky and isHeavy:\n",
    "            return 'Both'\n",
    "        if isBulky:\n",
    "            return 'Bulky'\n",
    "        if isHeavy:\n",
    "            return 'Heavy'\n",
    "        return 'Neither'"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def categorizeBox(self, length: int, width: int, height: int, mass: int) -> str:\n",
    "        heavy = mass >= 100\n",
    "        bulky = length >= 10000 or width >= 10000 or height >= 10000 or length*width*height >= 10**9\n",
    "        if heavy:\n",
    "            if bulky:\n",
    "                return \"Both\"\n",
    "            else:\n",
    "                return \"Heavy\"\n",
    "        else:\n",
    "            if bulky:\n",
    "                return \"Bulky\"\n",
    "            else:\n",
    "                return \"Neither\""
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def categorizeBox(self, length: int, width: int, height: int, mass: int) -> str:\n",
    "        Bulky = Heavy = False\n",
    "        if length >= 10 ** 4 or width >= 10 ** 4 or height >= 10 ** 4 or mass >= 10 ** 4:\n",
    "            Bulky = True\n",
    "        if length * width * height >= 10 ** 9:\n",
    "            Bulky = True\n",
    "        if mass >= 100:\n",
    "            Heavy = True\n",
    "        if Bulky and Heavy:\n",
    "            return 'Both'\n",
    "        return 'Bulky' if Bulky else 'Heavy' if Heavy else 'Neither' \n",
    "        "
   ]
  }
 ],
 "metadata": {},
 "nbformat": 4,
 "nbformat_minor": 2
}
